package com.sky.controller.admin;

import com.sky.dto.ReportLocalDateDTO;
import com.sky.result.Result;
import com.sky.service.ReportService;
import com.sky.vo.TurnoverReportVO;
import com.sky.vo.UserReportVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/report")
@Slf4j
@Api(tags = {"统计数据接口"})
public class ReportController {
    @Autowired
    ReportService reportService;
    @GetMapping("/turnoverStatistics")
    @ApiOperation("营业额统计")
    public Result<TurnoverReportVO> turnoverStatistic(@ModelAttribute ReportLocalDateDTO dto){
        log.info("管理员展示营业额统计，日期范围{}",dto);
        TurnoverReportVO turnoverReportVO = reportService.turnoverStatistic(dto);
        return Result.success(turnoverReportVO);
    }

    @GetMapping("/userStatistics")
    @ApiOperation("用户统计")
    public Result<UserReportVO> userStatistics(@ModelAttribute ReportLocalDateDTO dto){
        log.info("管理员展示用户统计，日期范围{}",dto);
        UserReportVO userReportVO = reportService.userStatistics(dto);
        return Result.success(userReportVO);
    }
}














